package com.person.bean;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import com.person.daoImpl.AdminDaoImpl;
import com.person.pojo.AdminJudgeInfos;
import com.person.vo.Admin;

public class AdminJudgeInfo{
	public AdminJudgeInfos getUserInfo(String username, String password) {
		AdminJudgeInfos aji = new AdminJudgeInfos();
		Admin am = new Admin();

		AdminDaoImpl adil = new AdminDaoImpl();
		ResultSet rs = adil.accntAndpassdVerif(username, password);
		try {
			if(rs.next()) {
				aji.setMatch(true);
				
				am.setId(rs.getInt(1));
				am.setUsername(rs.getString(2));
				am.setPassword(rs.getString(3));
				am.setUsername(rs.getString(4));
				
				aji.setUserInfo(am);
			}else {
				am.setUsername(username);
				am.setPassword(password);
				aji.setUserInfo(am);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return aji;
	}
}